package cn.lijida.weiwei.favor.modules.account.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.lijida.weiwei.favor.commons.constant.Conf;
import cn.lijida.weiwei.favor.commons.utils.ReturnT;
import cn.lijida.weiwei.favor.commons.validator.AddGroup;
import cn.lijida.weiwei.favor.modules.account.entity.FavorAccount;
import cn.lijida.weiwei.favor.modules.account.service.IFavorAccountService;

/**
 * <p>
 * 账簿 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-12-28
 */
@RestController
@RequestMapping("/account/center")
public class FavorAccountController {

	@Autowired
	private IFavorAccountService accountService;
	
	@PostMapping("account")
	public ReturnT<String> create(@RequestBody @Validated({AddGroup.class}) FavorAccount account, @RequestAttribute(Conf.LOGIN_ID) Long loginId) throws Exception{
		
		accountService.create(account,loginId);
		
		return ReturnT.SUCCESS;
	}
}
